import { ProSchemaValueEnumMap } from '@ant-design/pro-utils/es/typing'

export const covertTableData = (data: any) => {
  return {
    pages: data.pages,
    current: data.current,
    total: data.total,
    data: data.records,
  }
}
export const convertEnum = (data: any, field: { label: string; value: string }): ProSchemaValueEnumMap => {
  return (
    data?.reduce((acc, curr) => {
      acc[curr[field.value]] = {
        text: curr[field.label],
      }
      return acc
    }, {}) || {}
  )
}
